<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>物料编辑</title>
	<!-- import css and js --> 
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
<script type="text/javascript">
var basic_Url="${ctx}/basic/materials";
var fileUpload_Url = "${ctx}/attach/upload";
$(function(){
$("#inputForm").validate({			   
	onsubmit: true,
	 /*执行ajaxsubmit  */ 
    submitHandler: function(editform) {
            
        //alert(jsonInfo); 
        try{			    		
            url =  basic_Url+"/save.do";
            var api = frameElement.api;
        	var W = api.opener;
            getReturnMessage(url,"inputForm",W.searchAP);
            W.pid='${pid}';
        }catch(e){alert(e);}
    }
 }
);


if ('${flag}' == 'add'){
	$("#zd029MaterTypeId").val("${parent.id}");
	$("#wlTypeName").val("${parent.zd002Name}");
}
if ('${flag}' == 'edit'){
	$("#wlTypeName").val("${parent.zd002Name}");
}
});
function submitForm(param){
    //设置ajax全局同步
	jQuery.ajaxSettings.async = false;
  	$("#submitFlag").val(param);
    $("#inputForm").submit();
 }		
 
function updateDescription(value){
	 $("#description").val($("#pname").val()+";"+value);
}
$(function(){
	$("#zd002Name").change(function(){
		$("#bizMnemonic").val(helpCode($("#zd002Name").val()))
		
	});
});
function selectFile(){
	var projectId = '${materials.id}';
	getDG().dialog({
				title : '附件上传',
				width : 650,
				height : 350,
				content : 'url:' + fileUpload_Url + '/canFileUploadManager.do?projectId='+projectId,
				lock : true,
				max : true,
				min : true,
				ok : function() {
		    			var rows = this.content.grid.getData();
 		    			var fileIds = "";
 							if (rows != null) {
 								for (var i = 0; i < rows.length;i++){
 									if(i!=0){
										fileIds+=",";
 									}
 							    	//获得行数据
 									var row = rows[i];
 							    	fileIds += row.id;
 								}
 								$("#zd035FileUppath").val(fileIds);
 								this.content.Close();
 							}
			        		return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex();
	/* 
	getDG().dialog({
				title : '附件上传',
				width : 650,
				height : 350,
				content : 'url:' + fileUpload_Url+ '/canFileUploadManager.do',    
				lock : true,
				max : true,
				min : true,
				ok : function() {
					String fileIds = "";
					var rows = this.content.grid.getData();
					if(rows != null){
						for (var i = 0; i < rows.length;i++){
							if(i!=0){
								fileIds+=",";
							}
					    	//获得行数据
							var row = rows[i];
					    	fileIds += row.id;
						}
						$("#zd035FileUppath").val(path);
						this.content.Close();
					}
					return false;
				},
				cancelVal : '关闭',
				cancel : true
			}).zindex(); */
}
</script>

</head>

<body>

<form id="inputForm" action="" method="post">
<input type="hidden" id="id" name="id" value="${materials.id}"/>
<input type="hidden" id="bizVersion" name="bizVersion" value="${materials.bizVersion}"/>
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
 <div class="pageContent" >
    <div class="panel">
         <table class="TableBlock" align="center">
         			<tr>
          				<c:if test="${not empty materials.zd001Code}">
   		            	<td nowrap="nowrap">材料编码:</td>
   		                 <td>
   		                		<input type="text" id="zd001Code" name="zd001Code" class="required" disabled="disabled" style="width: 40%;" value="${materials.zd001Code}"  size="50%" />
   		                 </td>   
   		             	</c:if>    
   		           </tr>
          			<tr>
          				<td nowrap="nowrap">材料名称:</td>
   		                 <td>
   		                		<input type="text" id="zd002Name" name="zd002Name" class="required" style="width: 40%;"   value="${materials.zd002Name}" />
   		                 </td>
   		                 <td nowrap="nowrap">物料类型:</td>
   		                 <td>
   		                		<input type="text" id="wlTypeName" name="wlTypeName"  disabled="disabled"  value="" style="width: 40%;"/>
   		                		<input type="hidden" id="zd029MaterTypeId" name="zd029MaterTypeId" value="${materials.zd029MaterTypeId}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		                 <td nowrap="nowrap">型号:</td>
   		                 <td>
   		                		<input type="text" id="zd004Model" name="zd004Model"  style="width: 40%;"   value="${materials.zd004Model}"/>
   		                 </td>
   		                 <td nowrap="nowrap">尺寸:</td>
   		                 <td>
   		                		<input type="text" id="zd026Size" name="zd026Size"  style="width: 40%;"   value="${materials.zd026Size}"/>
   		                 </td>
   		           </tr>
   		           <tr>
   		                 <td nowrap="nowrap">颜色:</td>
   		                 <td>
   		                		<input type="text" id="zd033Color" name="zd033Color"  style="width: 40%;"   value="${materials.zd033Color}"/>
   		                 </td>
   		                 <td nowrap="nowrap">材质:</td>
   		                 <td>
   		                 <select id="zd034Quality" name="zd034Quality" >
   		                 	<option></option>
   		                 	<c:forEach items="${quality }" var="quality">
   		                 		<option value="${quality.zd002Name }">${quality.zd002Name }</option>
   		                 	</c:forEach>
   		                 </select>
   		                 <script type="text/javascript">
   		                 	$("#zd034Quality").val('${materials.zd034Quality}');
   		                 </script>
   		                 </td>
   		           </tr>
   		            <tr>
   		                 <td nowrap="nowrap">进货价:</td>
   		                 <td>
   		                		<input type="text" id="zd009Price" name="zd009Price" style="width: 40%;"  value="${materials.zd009Price}" />
   		                 </td>
   		                 <td nowrap="nowrap">零售价:</td>
   		                 <td>
   		                		<input type="text" id="zd010RetailPrice" name="zd010RetailPrice" style="width: 40%;"  value="${materials.zd010RetailPrice}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		                 <td nowrap="nowrap">助记码:</td>
   		                 <td>
   		                		<input type="text" id="bizMnemonic" name="bizMnemonic" style="width: 40%;"  value="${materials.bizMnemonic}" />
   		                 </td>
   		                 <td nowrap="nowrap">产品系列:</td>
   		                 <td>
   		                		<input type="text" id="zd028ProductRange" name="zd028ProductRange"  style="width: 40%;"   value="${materials.zd028ProductRange}"/>
   		                 </td>
   		           </tr>
   		           <tr>
   		                 <td nowrap="nowrap">功能说明:</td>
   		                 <td>
   		                		<input type="text" id="zd006Description" name="zd006Description"  style="width: 40%;"   value="${materials.zd006Description}" />
   		                 </td>
   		                 <td nowrap="nowrap">货架编号:</td>
   		                 <td>
   		                		<input type="text" id="zd027Shelf" name="zd027Shelf"  style="width: 40%;"   value="${materials.zd027Shelf}"/>
   		                 </td>
   		           </tr>
   		            <tr>
   		                <td nowrap="nowrap">默认仓库:</td>
   		                 <td>
   		                 <select id="zd017DefaultWhId" name="zd017DefaultWhId">
   		                 	<option></option>
   		                 	<c:forEach items="${wh }" var="wh">
   		                 		<option value="${wh.id }">${wh.zd003Name }</option>
   		                 	</c:forEach>
   		                 </select>
   		                 <script type="text/javascript">
   		                 	$("#zd017DefaultWhId").val('${materials.zd017DefaultWhId}');
   		                 </script>
   		                 </td>
   		                 <td nowrap="nowrap">最高库存:</td>
   		                 <td>
   		                		<input type="text" id="zd012HighestInventory" name="zd012HighestInventory"   style="width: 40%;" value="${materials.zd012HighestInventory}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		                 <td nowrap="nowrap">最低库存:</td>
   		                 <td>
   		                		<input type="text" id="zd011MinmunInventory" name="zd011MinmunInventory"  style="width: 40%;"  value="${materials.zd011MinmunInventory}" />
   		                 </td>
   		                 <td nowrap="nowrap">安全库存数量:</td>
   		                 <td>
   		                		<input type="text" id="zd013SafetyStock" name="zd013SafetyStock" style="width: 40%;"   value="${materials.zd013SafetyStock}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		             <td>基本单位:</td>
   		             <td>
                 		<select id="zd007Unit" name="zd007Unit"  class="required" >
	                 		<option></option>
 		                 		<c:forEach items="${unit}" var="unitDOs">
 		                 			<option value="${unitDOs.id }">${unitDOs.zd002Name }</option>
 		                 		</c:forEach>
 		                </select>
 		                <script type="text/javascript">
							$("#zd007Unit").val('${materials.zd007Unit}');
				    	</script>
				    	
   		             </td>
   		             <td nowrap="nowrap">图片:</td>
   		                 <td>
   		                		<input type="text" name="zd035FileUppath" id="zd035FileUppath"readonly="readonly"  style="width: 40%;"/>
   		                		<input type="button" value="选择" onclick="selectFile();"/>
   		                 </td>
   		           </tr>
   		           <tr>
   		                 <td nowrap="nowrap">数量精度:</td>
   		                 <td>
   		                		<input type="text" id="zd018QuantitAccuracy" name="zd018QuantitAccuracy"  style="width: 40%;"  value="${materials.zd018QuantitAccuracy}" />
   		                 </td>
   		                 <td nowrap="nowrap">保质期:</td>
   		                 <td>
   		                		<input type="text" id="zd019ShelfLife" name="zd019ShelfLife"  style="width: 40%;"  value="${materials.zd019ShelfLife}" />
   		                 </td>
   		           </tr>
   		           
   		         <!--  <tr>
   		             <td>是否开启批次:</td>
   		             <td>
			             <select id="zd025OpenBatch" name="zd025OpenBatch" class="required" >
	                		<option></option>
		                 	<option value="0">是</option>
		                 	<option value="1">否</option>
	                	</select>
	                	<c:if test="${not empty materials.zd025OpenBatch }">
	                		<script type="text/javascript">
	                			$("#zd025OpenBatch").val('${materials.zd025OpenBatch}');
	                		</script>
	                	</c:if>
   		             </td>
   		           </tr> -->  
                </table>               
         </div>
         <div class="formBar">
	        <ul>
		       <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="save" onclick="submitForm(1)">保存</button></div></div></li>
		       <li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>    
    </div>
</form>

</body>
</html>
